(* test-forth.joy -- tests for forth.joy
   Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
  
   Joy is free software; you can redistribute it and/or modify it under
   the terms of the GNU General Public License as published by the Free
   Software Foundation; either version 3 of the License, or (at your
   option) any later version.
  
   Joy is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
   License for more details.
  
   You should have received a copy of the GNU General Public License
   along with Joy.  If not, see <http://www.gnu.org/licenses/>.
*)

"forth" include
"inicheck" include

DEFINE
  test-drop == "drop" [1 2 3 drop] satisfies [2 =] ? ;
  test-over == "over" [1 2 over] satisfies [1 =] ? ;
  test-nip  == "nip"  [1 2 3 nip] satisfies [3 = [1 =] dip and] ? ;
  test-tuck == "tuck" [1 2 tuck] satisfies [2 = [1 = [2 =] dip and]
                                                dip and] ? ;
  test-rot  == "rot"  [1 2 3 rot] satisfies [1 =] ? ;
  test--rot == "-rot" [1 2 3 -rot] satisfies [2 =] ? ;
  test-pick == "pick" [1 7 3 4 2 pick] satisfies [7 =] ? ;

  test-forth ==
    test-drop
    test-over
    test-nip
    test-tuck
    test-rot
    test--rot
    test-pick ;
END

test-forth
